<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1.0" />
        <title>博客管理</title>
        <link rel="stylesheet" th:href="@{/Semantic-UI-CSS-master/semantic.min.css}"/>
       <link rel="stylesheet" href="../../../lib/editormd/css/editormd.min.css" />
        <link rel="stylesheet" th:href="@{/css/me.css}"/>
	</head>
	<body>
        <div class="bbb">
        <!-- 导航 -->
        <nav class="ui inverted attached segment m-padded-tb-min">
           <div class="ui container">
             <div class="ui inverted secondary stackable menu">
                 <h2 class="ui teal header item">管理后台</h2>
                 <a th:href="@{/admin/blogs}" class="active item m-item m-mobile-hide"><i class="home icon"></i>博客</a>
                 <a th:href="@{/admin/types}" class="item m-item m-mobile-hide"><i class="idea icon"></i> 分类</a>
                 <a th:href="@{/admin/tags}" class="item m-item m-mobile-hide"><i class="tags icon"></i> 标签</a>
                 <a th:href="@{/admin/blogs/file}" class="item m-item m-mobile-hide"><i class="tags icon"></i> 文件上传</a>
                <div class="right item">
                    <div class="ui dropdown item">
                 <div class="text">
                     <img class="ui avatar image m-img-mid" th:src="@{/img/logo-icon-3.png}" />
                    韦建韩
                 </div>
                 <i class="dropdown icon"></i>
                 <div class="menu">
                     <a href="/admin/loginOut" class="item">注销</a>
                     
                 </div>
                </div>
                </div>
             </div>  
           </div>
           <a href="#" class="ui menu toggel black icon button m-right-top m-mobile-show">
               <i class="sidebar icon"></i>
           </a>
        </nav>
        <div class="ui attached pointing menu">
            <div class="ui container">
                <a href="#" class="active item">发布</a>
                <a href="#" class="item">列表</a>
            </div>
            
        </div>
        <!-- 中间内容 -->
        <div class="m-padded-tb-lager m-container">
            <div class="ui container">
           <form id="blog-form" action="/admin/blogs/save"  method="post" class="ui form">
               <input type="hidden" name="published">

               <div class="required field">
             <div class="ui left labeled input">
               <div class="ui selection compact teal basic dropdown label">
                   <input type="hidden" name="flag" value="原创" />
                   <i class="dropdown icon"></i>
                   <div class="default text">原创</div>
                 <div class="menu">
                     <div class="item" data-value="原创">原创</div>
                     <div class="item" data-value="转载">转载</div>
                     <div class="item" data-value="翻译">翻译</div>
                 </div>
               </div>  
         
           
                 <input type="text" name="title" id="title" placeholder="标题" />
           </div>
           </div>
           <div class="required field">
               <div id="md-content" style="z-index: 1 !important">
              <textarea placeholder="博客内容" name="content"  style="display: none;">

              </textarea>
                   
               </div>
           </div>
           <div class="two fields">
               <div class="required field">
                   <div class="ui left labeled input">
                       <label class="ui compact teal basic label">分类</label>
                   <div class="ui  selection dropdown">
                       <input type="hidden" name="type">
                       <i class="dropdown icon"></i>
                         <div class="default text">分类</div>
                         <div class="menu">
               <div th:each="type : ${types}"  class="item" th:data-value="${type.id}"  th:text="${type.name}">错误日志</div>
                         </div>
                         </input>
                   </div>
                   </div>
               </div>
               <div class="required field">
                   <div class="ui left labeled input">
                       <label class="ui compact teal basic label">标签</label>
                   <div class="ui selection multiple search  dropdown">
                       <input type="hidden" name="tagIds">
                       <i class="dropdown icon"></i>
                         <div class="default text">标签</div>
                         <div class="menu">
                             <div class="item" th:each="tag : ${tags}" th:data-value="${tag.id}" th:text="${tag.name}"></div>
                         </div>
                         </input>
                   </div>
                   </div>
               </div>
               
              
           </div>

            <div class="inline fields">
                          <div class="field">
                              <div class="ui checkbox">
                                  <input type="checkbox"  id="recommend" class="hidden" name="recommend" />
                                  <label for="recommend">推荐</label>
                              </div>
                          </div>
                          <div class="field">
                              <div class="ui checkbox">
                                  <input type="checkbox" id="shareStatement" class="hidden" name="shareStatement" />
                                  <label for="shareStatement">转载声明</label>
                              </div>
                          </div>
                          <div class="field">
                              <div class="ui checkbox">
                                  <input type="checkbox" id="appreciation"  class="hidden" name="appreciation" />
                                  <label for="appreciation">赞赏</label>
                              </div>
                          </div>
                          <div class="field">
                              <div class="ui checkbox">
                                  <input type="checkbox" id="commentabled" class="hidden" name="commentabled" />
                                  <label for="commentabled">评论</label>
                              </div>
                          </div>
                      </div>
                      <div class="ui error message"></div>
                      <div class="ui right aligned container">
                          <button type="button" class="ui basic button" onclick="windows.history.go(-1)">返回</button>
                          <button id="save-btn" class="ui secondary button">保存</button>
                          <button id="publish-btn" class="ui teal button">发布</button>
                      </div>
           </form>
           
             </div>
              
            </div>
            
          
        <!-- 底部footer -->
        <footer class="ui inverted vertical segment m-padded-tb-massive">
            <div class="ui center aligned container">
                <div class="ui inverted divided stackable grid">
                 <div class="three wide column">
                     <img th:src="@{/static/img/logo-icon-3.png}" class="ui rounded image" alt="" style="width: 110px;"/>
                 </div>
                 <div class="three wide column">
                     <h4 class="ui inverted header">最新博客</h4>
                     <div class="ui inverted link list">
                         <a href="#" class="item">用户故事(User Story)</a>
                         <a href="#" class="item">用户故事(User Story)</a>
                         <a href="#" class="item">用户故事(User Story)</a>
                     </div>
                 </div>
                 <div class="three wide column"><h4 class="ui inverted header">联系我</h4>
                     <div class="ui inverted link list">
                         <a href="#" class="item">手机：17877887975</a>
                         <a href="#" class="item">QQ:2805319253</a>
                         <a href="#" class="item">邮箱：2805319253@qq.com</a>
                     </div></div>
                 
                 <div class="seven wide column">
                     <h4 class="ui inverted header">简介</h4>
                     <p>这是我的个人博客，我会与大家分享我的各种学习体会。</p>
                 </div>
                 
                </div>
                <div class="ui inverted section divider"></div>
               <p>韦建韩 就读于广西科技大学-启迪数字学院-软件工程专业</p>
                </div>
        </footer>
        </div>
        <script th:src="@{/Semantic-UI-CSS-master/jquery.js}"></script>
        
        <script th:src="@{/Semantic-UI-CSS-master/semantic.min.js}"></script>
        <script src="../../../lib/editormd/editormd.min.js"></script>
        <script>
            var contentEditor;
            
                        $(function() {
                            contentEditor = editormd("md-content", {
                                width   : "100%",
                                height  : 640,
                                syncScrolling : "single",
                                path    : "../../../lib/editormd/lib/"
                            });
                            
                            /*
                            // or
                            testEditor = editormd({
                                id      : "test-editormd",
                                width   : "90%",
                                height  : 640,
                                path    : "../lib/"
                            });
                            */
                        });
            
            
            $(".menu.toggle").click(function(){
                $(".m-item").toggleClass("m-mobile-hide");
            });
       $('.ui.dropdown').dropdown();
       $('.ui.form').form({
           fields: {
               title: {
                   identifier: "title",
                   rules: [{
                       type: "empty",
                       prompt: "标题： 请输入博客标题"
                   }]
               },
               content: {
                   identifier: "content",
                   rules: [{
                       type: "empty",
                       prompt: "内容： 请输入博客内容"
                   }]
               },
               tagIds: {
                   identifier: "tagIds",
                   rules: [{
                       type: "empty",
                       prompt: "标签： 请输入博客标签"
                   }]
               },
               firstPicture: {
                   identifier: "firstPicture",
                   rules: [{
                       type: "empty",
                       prompt: "首图： 请选择博客首图"
                   }]
               },
               type: {
                   identifier: "type",
                   rules: [{
                       type: "empty",
                       prompt: "类型： 请选择博客类型"
                   }]
               },
               description: {
                   description: "firstPicture",
                   rules: [{
                       type: "empty",
                       prompt: "描述： 请选择博客描述"
                   }]
               }



           }
       })


            $('#save-btn').click(function () {
        $('[name="published"]').val(false);
        $('#blog-form').submit();
            })
            $('#publish-btn').click(function () {
                $('[name="published"]').val(true);
                $('#blog-form').submit();
            })

        </script>
    </body>
</html>
